/*   Copyright (C) 2008  Jeroen v. Schagen & Youri Lima
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

using System;

namespace Engine.Math
{
    /// <summary>
    ///     Represents the unit of a plane angle. 
    /// 
    ///     The radian is equal to 180/PI degrees or about 57.2958 degrees.
    /// </summary>
    public struct Radian
    {
        public float value;

        # region Constructor

        /// <summary>
        ///     Construct radian using an angle.
        /// </summary>
        /// 
        /// <param name="value"></param>
        public Radian(float value)
        {
            this.value = value;
        }

        /// <summary>
        ///     Construct radian using a radian object.
        /// </summary>
        /// 
        /// <param name="radian"></param>
        public Radian(Radian radian)
        {
            this.value = radian.value;
        }

        /// <summary>
        ///     Construct radian using a degree object.
        /// </summary>
        /// 
        /// <param name="degree"></param>
        public Radian(Degree degree)
        {
            this.value = degree.value * ((float) System.Math.PI / 180f);
        }

        # endregion


        # region Converter

        /// <summary>
        ///     Converts current angle to a Degree.
        /// </summary>
        /// 
        /// <returns></returns>
        public Degree ToDegree()
        {
            return new Degree(this);
        }

        /// <summary>
        ///     Converts current angle to a String.
        /// </summary>
        /// 
        /// <returns></returns>
        public override String ToString()
        {
            return value.ToString();
        }

        # endregion
    }
}
